package dcpu
type Input uint16

const (
  // Basic Opcodes: note these are the lower 5 bits of the instruction
  SpecialOp uint16= iota
  SET
  ADD
  SUB
  MUL
  MLI
  DIV
  DVI
  MOD
  MDI
  AND
  BOR
  XOR
  SHR
  ASR
  SHL
  IFB
  IFC
  IFE
  IFN
  IFG
  IFA
  IFL
  _
  _
  ADX
  SBX
  _
  _
  STI
  STD
  
  //Special Opcodes: these are also 5 bits
  JSR uint16=32
  INT uint16=8  << 5
  IAG uint16=9  << 5
  INT uint16=10 << 5
  INT uint16=11 << 5
  INT uint16=12 << 5
  INT uint16=16 << 5
  INT uint16=17 << 5
  INT uint16=18 << 5
  
  //Input Values
  A,B,C,X,Y,Z,I,J Input=iota
  //Register Modifiers
  WORD_AT_REG Input = 8
  WORD_AT_REG_PLUS Input = 16
  //Stack Values
  PUSH,POP Input = 24
  PEEK Input = 25
  PICK Input = 26
  SP Input = 27
  //Special Inputs
  PC Input = 28
  EX Input = 29
  WORD_AT_NEXT Input = 30
  NEXT Input = 31
)

func(i Input)A()uint16{
  return i << 10
}
func(i Input)B()uint16{
  return (i&31)<<5
}